package com.bdq.recommend.api.controller;

import cn.hutool.core.convert.Convert;
import com.bdq.common.entity.common.CommonResult;
import com.bdq.common.entity.common.PageResult;
import com.bdq.common.feign.content.vo.ContentListVO;
import com.bdq.recommend.api.model.param.RecommendPageParam;
import com.bdq.recommend.application.model.query.RecommendPageQry;
import com.bdq.recommend.application.service.impl.RecommendQueryService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * bdq-recommend内容相关
 *
 * @author malei
 * @date 2024-05-10 11:13
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {

    @Resource
    private RecommendQueryService recommendQueryService;

    /**
     * 推荐分页
     *
     * @param param
     * @return
     */
    @GetMapping("/page")
    public CommonResult<PageResult<ContentListVO>> pageRecommend(@Validated RecommendPageParam param){
        return CommonResult.success(recommendQueryService.pageRecommend(Convert.convert(RecommendPageQry.class, param)));
    }
}
